package com.tidc.seaservermodel.entity;

import com.tidc.seaservermodel.verify.SecondaryUserVerify;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * (User)实体类
 *
 * @author makejava
 * @since 2020-09-11 11:06:31
 */
@Data
@NoArgsConstructor
@Accessors(chain = true) //这个注解可以使这个类的set方法返回当前对象
public class User implements Serializable {
    private static final long serialVersionUID = 991063373704819853L;
    
    private Integer id;

    @NotNull(message = "username 不能为空", groups = {SecondaryUserVerify.class})
    private String username;
    @Pattern(regexp = "^[0-9A-Za-z]{6,20}$", message = "密码格式不正确", groups = {SecondaryUserVerify.class})
    @NotNull(message = "密码不能为空", groups = {SecondaryUserVerify.class})
    private String password;
    @Pattern(regexp = "0?(13|14|15|17|18|19)[0-9]{9}", message = "手机号不正确")
    @NotNull(message = "手机号不能空")
    private String phone;
    private String name;
    private Integer typeClassify;
    private Integer levelValue;
    private Integer money;
    private Integer superiorUserId;
    private Integer isDelete;
    private String code;
    public void replaceAll(){
        name = name.replaceAll("\\s*", "");
        username = username.replaceAll("\\s*", "");
        password = password.replaceAll("\\s*", "");
        phone = phone.replaceAll("\\s*", "");
    }

}